﻿<controls:FloatableWindow
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=FloatableWindow"
      xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:local="clr-namespace:CityLife.Classes"
    xmlns:shader="clr-namespace:CityLife.Classes.Shader"
    
           xmlns:controls1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
    x:Class="CityLife.Controls.Recorder"
           Width="628" Height="478" 
           Title="Webcam Recorder">
    <ContentControl.Resources>
        <local:RecorderViewModel x:Name="RecorderViewModel"></local:RecorderViewModel>
        <DataTemplate x:Key="ImagesItemTemplate">
            <Image Source="{Binding Path=Bitmap}" Name="{Binding Path=Name}" Stretch="UniformToFill" Width="50" Height="50"/>
        </DataTemplate>
        <ItemsPanelTemplate x:Key="ImagesItemPanel">
            <controlsToolkit:WrapPanel></controlsToolkit:WrapPanel>
        </ItemsPanelTemplate>
    </ContentControl.Resources>
  

    <Grid x:Name="LayoutRoot" Margin="2">
		<Grid.RowDefinitions>
			<RowDefinition />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>

       


        <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
		<Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />


        <Button Content="Capture" Height="23" HorizontalAlignment="Left"  VerticalAlignment="Center" Width="75" Click="Capture_Click" Grid.Row="1" Margin="0,12,0,0" />
        <Button Content="Save" Height="23" HorizontalAlignment="Left" VerticalAlignment="Center" Width="75" Click="Button_Click" Grid.Row="1" Margin="81,12,0,0" />

        
        
        
        <controls1:TabControl Margin="0,0,8,8">
            <controls1:TabItem Header="You">


                <Grid x:Name="CamStudio" Background="White" DataContext="{Binding Source={StaticResource RecorderViewModel}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="335" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="260" />
                        <RowDefinition Height="60*" />
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal" Width="Auto" Height="Auto" Grid.ColumnSpan="2">
                        <Grid HorizontalAlignment="Left" VerticalAlignment="Top"  Width="Auto" Height="Auto" Margin="10,10,5,0">
                            <Rectangle Name="rectVideo" Width="320" Height="240" Fill="Black" MouseLeftButtonDown="rectVideo_MouseLeftButton" VerticalAlignment="Top"/>
                            <TextBlock Name="textClickMsg" Foreground="White" Text="Click to Access Camera" VerticalAlignment="TOp" HorizontalAlignment="Center" Margin="0,10,0,10" Opacity=".6"/>
                        </Grid>
                        <ListBox Grid.Column="1" Height="Auto" Name="listImages" Width="230" Margin="5,10,10,10" 
                 ItemsSource="{Binding Path=Captures, Mode=TwoWay}"
                 ItemTemplate="{StaticResource ImagesItemTemplate}"
                 ItemsPanel="{StaticResource ImagesItemPanel}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 ScrollViewer.VerticalScrollBarVisibility="Auto"
                 >
                        </ListBox>
                    </StackPanel>
                    <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" Width="Auto" HorizontalAlignment="Left" Name="effects" Visibility="Visible">
                        <Rectangle Name="none" Height="36" HorizontalAlignment="Left" Margin="10,0,3,0" VerticalAlignment="Center" Width="48" MouseLeftButtonDown="Effect_MouseLeftButtonDown"/>
                        <Rectangle Name="invert" Height="36" HorizontalAlignment="Left" Margin="3,0" VerticalAlignment="Center" Width="48" MouseLeftButtonDown="Effect_MouseLeftButtonDown">
                            <Rectangle.Effect>
                                <shader:InvertColorEffect/>
                            </Rectangle.Effect>
                        </Rectangle>
                        <Rectangle Name="mono" Height="36" HorizontalAlignment="Left" Margin="3,0" VerticalAlignment="Center" Width="48" MouseLeftButtonDown="Effect_MouseLeftButtonDown">
                            <Rectangle.Effect>
                                <shader:MonochromeEffect/>
                            </Rectangle.Effect>
                        </Rectangle>
                        <Rectangle Name="tone" Height="36" HorizontalAlignment="Left" Margin="3,0" VerticalAlignment="Center" Width="48" MouseLeftButtonDown="Effect_MouseLeftButtonDown">
                            <Rectangle.Effect>
                                <shader:ColorToneEffect Toned="2" LightColor="Brown"/>
                            </Rectangle.Effect>
                        </Rectangle>
                        <Rectangle Name="swirl" Height="36" HorizontalAlignment="Left" Margin="3,0" VerticalAlignment="Center" Width="48" MouseLeftButtonDown="Effect_MouseLeftButtonDown">
                            <Rectangle.Effect>
                                <shader:SwirlEffect SwirlStrength="2.5"/>
                            </Rectangle.Effect>
                        </Rectangle>
                        <Rectangle Name="emboss" Height="36" HorizontalAlignment="Left" Margin="3,0" VerticalAlignment="Center" Width="48" MouseLeftButtonDown="Effect_MouseLeftButtonDown">
                            <Rectangle.Effect>
                                <shader:EmbossedEffect Amount="15" Width=".01"/>
                            </Rectangle.Effect>
                        </Rectangle>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" Width="Auto" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="1" >
                        <Button Content="Capture" Height="23" HorizontalAlignment="Left" Margin="10,10,5,10" VerticalAlignment="Center" Width="75" Click="Capture_Click" />
                        <Button Content="Save" Height="23" HorizontalAlignment="Left" Margin="10,10,5,10" VerticalAlignment="Center" Width="75" Click="Button_Click" />

                    </StackPanel>
                </Grid>





            </controls1:TabItem>
			<controls1:TabItem Header="Metropoline friends">
                <controlsToolkit:BusyIndicator Name="PlayersListLoader"
                    IsBusy="False"
                    DisplayAfter="0"
                    BusyContent="loading...">
                    <ListBox x:Name="PlayersList">

                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Text="{Binding name}"></TextBlock>
                                </StackPanel>

                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </controlsToolkit:BusyIndicator>




            </controls1:TabItem>
			 
		</controls1:TabControl>
	</Grid>
</controls:FloatableWindow>